afterServerSideSummaryCompute Event

Arguments

summaryobject

An object that contains the summary values for all fields for which summary values were calculated. Summary values for each field can be referenced using array notation. For example, summary['QTY'].total. Each field in the summary object has the following properties:

Fields in summary are always referenced using uppercase.
totalnumber

The total computed for the field.

countnumber

The count computed for the field.

avgnumber

The average computed for the field.

minnumber

The minimum value for the field.

maxnumber

The maximum value for the field.

Description

Fires after the server-side summary values have been computed.

Discussion

The afterServerSideSummaryCompute event is triggered after the summary values for fields in the List control have been computed on the server. Computed summary values are available in the summary argument. Your function also has access to lObj, which is the List control's JavaScript Object.

A common use case for this event is to display the summary values in a control or DIV in the UX Component. For example:

// Get the total count for QTY and total cost:
var itemsOrdered = summary['QTY'].total;
var invoiceCost = summary['TOTAL'].total;

// Display values in two labels in the UX:
{dialog.object}.setValue('INVOICE_TOTAL',invoiceCost);
{dialog.object}.setValue('TOTAL_ITEMS_ORDERED',itemsOrdered);

Server side summary calculations are only available for lists based on SQL data.

The summary value will only be available for a field if you specified that it should be computed. Summary values can be enabled on the List Builder Fields pane in the Server-side section.

Formatting Summary Values

This event can be used to apply formatting to the summary values before they're displayed in a List's [Column footer template]. To format values, you must use the lObj.ssSummary object, not summary. For example:

var qTotal = lObj.ssSummary['QUANTITY'].total;

if (qTotal > 1000) {
  lObj.ssSummary['QUANTITY'].total = '<span style="color:green;font-weight:bold;">'+qTotal+'</span>';
}

If the Quantity is greater than 1000, the value will be displayed bold and green in the column footer. Otherwise, the value is unmodified.

If you modify the summary value to add HTML or other non-numeric data, the values cannot be used in computations without first removing the non-numeric markup.

Videos

Server-side Summary Values

For List controls that are based on SQL data, you can specify that summary data (e.g. total, avg, count, min and max) should be computed for certain columns in the List control. The summary computations are based on the List query (not on the rows actually visible in the List). In the case of a paginated List, there may be more rows in the query than are visible in the List. For example, the query might have 1,000,000 rows, but the list might show 20 rows at a time.

This video shows how a List control is configured to compute summary values, and then how the afterServerSideSummaryCompute event in the List is used to update a label on the UX component showing the summary values.

See Also